export default {
	// 获取页面数据
	getTableData() {
		var params = {
			// type:0,
			language: this.$store.getters.getLanguage,
			// page: this.$refs.Page.pagination.current,
			// limit: this.$refs.Page.pagination.pageSize
		}

		this.axiosGets("Contact/contactList", params, function(res) {

			this.tableData = res.data.data
			//分页
			// this.total = res.data.data.total
			// console.log(this.total);
		})
	},

	//添加
	add() {
		// this.history('/admin/edit')
		this.$refs.Edit.isShow = true;
	},

	//编辑
	edit(scope) {
		this.$refs.Edit.form.id = scope.id;
		this.$refs.Edit.form.company = scope.company;
		this.$refs.Edit.form.company_address = scope.company_address;
		this.$refs.Edit.form.area = scope.area;
		this.$refs.Edit.form.phone = scope.phone;
		this.$refs.Edit.form.fox = scope.fox;
		this.$refs.Edit.form.e_mail = scope.e_mail;
		// this.$refs.Edit.form.language = scope.language;
		// this.$refs.Edit.imageUrl = this.imgURL + scope.img_url;

		this.$refs.Edit.isShow = true;
	},

	//删除
	remove(scope) {
		this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
			confirmButtonText: '确定',
			cancelButtonText: '取消',
			type: 'warning'
		}).then(() => {

			this.sureRemove(scope.banner_id);
		}).catch(() => {
			this.$message({
				type: 'info',
				message: '已取消删除'
			});
		});
	},

	//确定删除
	sureRemove(id) {

		this.axiosGets("index/homepage/banner_delete?banner_id=" + id, {}, function(res) {
			if (res.data.code === 0) {
				this.getTableData();
				this.msgSuccess(res.data.msg)
			} else {
				this.msgError(res.data.msg)
			}
		})
	}
}
